<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<c:import url="/view/admin/include/header/adminHeader.jsp"></c:import>

        <dl class="">
            <dd class="summary">
            	<form id="boardFrm" name="boardFrm" method="post" enctype="multipart/form-data">
            	<input type="hidden" name="writer" value="<s:property value="#session.name" />"> 
            	<input type="hidden" id="save_type" name="save_type" value="case" />
            	<input type="hidden" id="case_seq" name="case_seq" value="${boardView.case_seq}" />
            	<input type="hidden" id="court_step" name="court_step" value="<%=request.getParameter("court_step")%>" />
            	<input type="hidden" id="complete" name="complete" value="<%=request.getParameter("complete") %>" />
            	<input type="hidden" id="log_seq" name="log_seq" value="${boardView.log_seq}" />
            	<table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
                          <col width="13%;"/>
                          <col width="87%;"/>
                         </colgroup>
                    <tbody>
                    	<tr>
                        	<th scope="row">날짜</th>
                            <td class="table_txt_left"><input class="datepicker" id="log_date" name="log_date" type="text" value="${boardView.log_date}" style="width:100px;" readonly="readonly"/>
                            </td>
                        </tr>
                        <tr>
                        	<th scope="row">주요내용</th>
                            <td class="table_txt_left"><input id="log_content" name="log_content" type="text" value="${boardView.log_content}" style="width:300px; height:140px;"/>
                            </td>
                        </tr>
                    	<tr>
                        	<th scope="row">비고</th>
                            <td class="table_txt_left"><input id="log_note" name="log_note" type="text"  value="${boardView.log_note}"  style="width:300px; height:100px;"/></td>
                           
                        </tr>  
                		<tr>
							<th scope="row">첨부파일</th>
							<td class="table_txt_left" style="font-size:11px;">
							<p>
							<s:if test="%{boardView.file1_name != null}">
								${boardView.file1_name}&nbsp;
                  				<img src="/images/common/btn_x.gif" id="btnFileDel" alt="파일삭제" style="cursor: pointer;"/>
                  			</s:if>
                  			<s:else>
	   							<input type="text" id="file_name1" class="input" style="width:200px; height:14px;"  title="첨부파일" readonly="readonly"/>
                  				<span class="file_input">
                  				<input type="file" name="uploads" class="file_input_hidden" title="첨부파일" style="cursor: pointer;" onchange="javascript: document.getElementById('file_name1').value = this.value" style="cursor: pointer;"/>
                  				<img src="/images/common/btn_file.gif" alt="첨부파일" name="find" id="find" border="0" style="cursor: pointer;"/>10MB이내 첨부
                  				</span>
	   						</s:else>
	   						</p>
	   						<p>
	   						<s:if test="%{boardView.file2_name != null}">
								${boardView.file2_name}&nbsp;
                  				<img src="/images/common/btn_x.gif" id="btnFileDel2" alt="파일삭제" style="cursor: pointer;"/>
                  			</s:if>
                  			<s:else>
	   							<input type="text" id="file_name2" class="input" style="width:200px; height:14px;"  title="첨부파일" readonly="readonly"/>
                  				<span class="file_input">
                  				<input type="file" name="uploads" class="file_input_hidden" title="첨부파일" style="cursor: pointer;" onchange="javascript: document.getElementById('file_name2').value = this.value" style="cursor: pointer;"/>
                  				<img src="/images/common/btn_file.gif" alt="첨부파일" name="find" id="find" border="0" style="cursor: pointer;"/>10MB이내 첨부
                  				</span>
	   						</s:else>
	   						</p>
	   						<p>
	   						<s:if test="%{boardView.file3_name != null}">
								${boardView.file3_name}&nbsp;
                  				<img src="/images/common/btn_x.gif" id="btnFileDel3" alt="파일삭제" style="cursor: pointer;"/>
                  			</s:if>
                  			<s:else>
	   							<input type="text" id="file_name3" class="input" style="width:200px; height:14px;"  title="첨부파일" readonly="readonly"/>
                  				<span class="file_input">
                  				<input type="file" name="uploads" class="file_input_hidden" title="첨부파일" style="cursor: pointer;" onchange="javascript: document.getElementById('file_name3').value = this.value" style="cursor: pointer;"/>
                  				<img src="/images/common/btn_file.gif" alt="첨부파일" name="find" id="find" border="0" style="cursor: pointer;"/>10MB이내 첨부
                  				</span>
	   						</s:else>
	   						</p>
							</td>
						</tr>
					</tbody>
                 </table>
                </div>
                 </form>
            </dd>
        </dl>
        <dl class="paginate">  	
            <dd class="space50">
            	<input type="button" id="btnWrite" value="수정" class="input_btn_s b" />
            </dd>
        </dl>
        <!-- 오른쪽 내용 부분 -->
    <!-- 컨텐츠 부분 -->
<c:import url="/view/admin/include/footer/adminFooter.jsp"></c:import>
<script type="text/javascript" src="/jquery/datepicker.js"></script>
<script type="text/javascript" src="/jquery/jquery.watermarkinput.js" ></script>
<script type="text/javascript">
	$().ready(function(){	
		 var complete = $("#complete").val();
		if(complete == '1'){
			var court_step = $("#court_step").val();
			var case_seq = <%=request.getParameter("case_seq") %>;
			//alert(case_seq);
			if($.browser.msie){
				window.opener.document.location.replace('/admin/caseupdatego3.hcom?case_seq='+case_seq+'&court_step='+court_step);
				window.close();
			}else{
				window.opener.document.location.replace('/admin/caseupdatego3.hcom?case_seq='+case_seq+'&court_step='+court_step);
				window.close();
			}
		} 
		$("#btnWrite").click(function(){
			if(validateCheck()){
				if(confirm("수정하시겠습니까?")){
					$("#boardFrm").attr('action','/admin/contentModiReg.hcom').submit();
					
					
					/* if($.browser.msie){
					window.opener.document.location.replace('/admin/caseupdatego1.hcom?court_step=${boardBean.court_step}&case_seq=${boardBean.case_seq}');
					window.close();
				}else{
					window.opener.document.location.replace('/admin/caseupdatego1.hcom?court_step=${boardBean.court_step}&case_seq=${boardBean.case_seq}');
					window.close();
				}
					 */
				}		
			}else{
				return;
			}
		});
		
		
	});
	$("#btnFileDel").click(function(){
		if(confirm("파일을 삭제하시겠습니까?")){
			location.href="/admin/casedeleteFile.hcom?attach_seq=${boardView.attach1_seq}&case_seq=${boardView.case_seq }&court_step=${boardView.court_step}&log_seq=${boardView.log_seq}";
		}
	});
	$("#btnFileDel2").click(function(){
		if(confirm("파일을 삭제하시겠습니까?")){
			location.href="/admin/casedeleteFile.hcom?attach_seq=${boardView.attach2_seq}&case_seq=${boardView.case_seq}&court_step=${boardView.court_step}&log_seq=${boardView.log_seq}";
		}
	});
	$("#btnFileDel3").click(function(){
		if(confirm("파일을 삭제하시겠습니까?")){
			location.href="/admin/casedeleteFile.hcom?attach_seq=${boardView.attach3_seq}&case_seq=${boardView.case_seq}&court_step=${boardView.court_step}&log_seq=${boardView.log_seq}";
		}
	});
	
	function validateCheck(){	
		
		if($("#log_date").val() == ''){
			alert('날짜를 입력해주십시요');
			$("#log_date").focus();
			return false;
		}
		if($("#log_content").val() == ''){
			alert('내용을입력해주십시요');
			return false;
		}	
		return true;
	} 
</script>
